 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

JCLOUD IoT Hub API
API related to IoT Hub

OpenAPI spec version: v2
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKIothub/IothubExecutor.h>

@implementation IothubClient

@synthesize userAgent = _userAgent;
@synthesize serviceName = _serviceName;
@synthesize version = _version;

-(void) addCustomerHeaderWithKey:(NSString*) key
                           value:(NSString*) value{
    if(![self customHeader])
    {
        self.customHeader = [[NSMutableDictionary alloc] init];
    }
    if(key && value)
    {
        [[self customHeader] setValue:value forKey:key];
    }
   
}

-(id)initWithGlobalConfig{
    if(![GlobalConfig credential])
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@"GlobalConfig credential not config" userInfo:nil];
        @throw e;
    }
    self.credential = [GlobalConfig credential];
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"iothub.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iothub  v2";
    _serviceName = @"iothub";
    _version = @"v2";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
         sdkEnvironment:(SDKEnvironment*)sdkEnvironment
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    
    if(!sdkEnvironment)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" sdkEnvironment can not null" userInfo:nil];
        @throw e;
    }else{
        self.sdkEnvironment = sdkEnvironment;
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iothub  v2";
    _serviceName = @"iothub";
    _version = @"v2";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"iothub.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iothub  v2";
    _serviceName = @"iothub";
    _version = @"v2";
    self.contentType = @"application/json";
    return self;
}

-(id)init{
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iothub  v2";
    _serviceName = @"iothub";
    _version = @"v2";
    self.contentType = @"application/json";
    return self;
}


/**
updateDevice sync request
@param updateDeviceRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `updateDeviceResponse` the request response data model
*/
-(NSDictionary*) updateDeviceSyncWithRequest:(IothubUpdateDeviceRequest*) updateDeviceRequest
{
IothubUpdateDeviceExecutor* excutor = [[IothubUpdateDeviceExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:updateDeviceRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubUpdateDeviceResponse* response = [[IothubUpdateDeviceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"updateDeviceResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)updateDeviceAsyncWithRequest:(IothubUpdateDeviceRequest*) updateDeviceRequest
                       completionHandler:(void(^)(int statusCode,IothubUpdateDeviceResponse* _Nullable updateDeviceResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubUpdateDeviceExecutor* excutor = [[IothubUpdateDeviceExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:updateDeviceRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubUpdateDeviceResponse* response = [[IothubUpdateDeviceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
listProductAbilities sync request
@param listProductAbilitiesRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `listProductAbilitiesResponse` the request response data model
*/
-(NSDictionary*) listProductAbilitiesSyncWithRequest:(IothubListProductAbilitiesRequest*) listProductAbilitiesRequest
{
IothubListProductAbilitiesExecutor* excutor = [[IothubListProductAbilitiesExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:listProductAbilitiesRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubListProductAbilitiesResponse* response = [[IothubListProductAbilitiesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"listProductAbilitiesResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)listProductAbilitiesAsyncWithRequest:(IothubListProductAbilitiesRequest*) listProductAbilitiesRequest
                       completionHandler:(void(^)(int statusCode,IothubListProductAbilitiesResponse* _Nullable listProductAbilitiesResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubListProductAbilitiesExecutor* excutor = [[IothubListProductAbilitiesExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:listProductAbilitiesRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubListProductAbilitiesResponse* response = [[IothubListProductAbilitiesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
deleteProduct sync request
@param deleteProductRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `deleteProductResponse` the request response data model
*/
-(NSDictionary*) deleteProductSyncWithRequest:(IothubDeleteProductRequest*) deleteProductRequest
{
IothubDeleteProductExecutor* excutor = [[IothubDeleteProductExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:deleteProductRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubDeleteProductResponse* response = [[IothubDeleteProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"deleteProductResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)deleteProductAsyncWithRequest:(IothubDeleteProductRequest*) deleteProductRequest
                       completionHandler:(void(^)(int statusCode,IothubDeleteProductResponse* _Nullable deleteProductResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubDeleteProductExecutor* excutor = [[IothubDeleteProductExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:deleteProductRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubDeleteProductResponse* response = [[IothubDeleteProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
removeDeviceById sync request
@param removeDeviceByIdRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `removeDeviceByIdResponse` the request response data model
*/
-(NSDictionary*) removeDeviceByIdSyncWithRequest:(IothubRemoveDeviceByIdRequest*) removeDeviceByIdRequest
{
IothubRemoveDeviceByIdExecutor* excutor = [[IothubRemoveDeviceByIdExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:removeDeviceByIdRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubRemoveDeviceByIdResponse* response = [[IothubRemoveDeviceByIdResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"removeDeviceByIdResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)removeDeviceByIdAsyncWithRequest:(IothubRemoveDeviceByIdRequest*) removeDeviceByIdRequest
                       completionHandler:(void(^)(int statusCode,IothubRemoveDeviceByIdResponse* _Nullable removeDeviceByIdResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubRemoveDeviceByIdExecutor* excutor = [[IothubRemoveDeviceByIdExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:removeDeviceByIdRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubRemoveDeviceByIdResponse* response = [[IothubRemoveDeviceByIdResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
exportThingModel sync request
@param exportThingModelRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `exportThingModelResponse` the request response data model
*/
-(NSDictionary*) exportThingModelSyncWithRequest:(IothubExportThingModelRequest*) exportThingModelRequest
{
IothubExportThingModelExecutor* excutor = [[IothubExportThingModelExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:exportThingModelRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubExportThingModelResponse* response = [[IothubExportThingModelResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"exportThingModelResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)exportThingModelAsyncWithRequest:(IothubExportThingModelRequest*) exportThingModelRequest
                       completionHandler:(void(^)(int statusCode,IothubExportThingModelResponse* _Nullable exportThingModelResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubExportThingModelExecutor* excutor = [[IothubExportThingModelExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:exportThingModelRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubExportThingModelResponse* response = [[IothubExportThingModelResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
invokeThingService sync request
@param invokeThingServiceRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `invokeThingServiceResponse` the request response data model
*/
-(NSDictionary*) invokeThingServiceSyncWithRequest:(IothubInvokeThingServiceRequest*) invokeThingServiceRequest
{
IothubInvokeThingServiceExecutor* excutor = [[IothubInvokeThingServiceExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:invokeThingServiceRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubInvokeThingServiceResponse* response = [[IothubInvokeThingServiceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"invokeThingServiceResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)invokeThingServiceAsyncWithRequest:(IothubInvokeThingServiceRequest*) invokeThingServiceRequest
                       completionHandler:(void(^)(int statusCode,IothubInvokeThingServiceResponse* _Nullable invokeThingServiceResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubInvokeThingServiceExecutor* excutor = [[IothubInvokeThingServiceExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:invokeThingServiceRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubInvokeThingServiceResponse* response = [[IothubInvokeThingServiceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
removeDevice sync request
@param removeDeviceRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `removeDeviceResponse` the request response data model
*/
-(NSDictionary*) removeDeviceSyncWithRequest:(IothubRemoveDeviceRequest*) removeDeviceRequest
{
IothubRemoveDeviceExecutor* excutor = [[IothubRemoveDeviceExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:removeDeviceRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubRemoveDeviceResponse* response = [[IothubRemoveDeviceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"removeDeviceResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)removeDeviceAsyncWithRequest:(IothubRemoveDeviceRequest*) removeDeviceRequest
                       completionHandler:(void(^)(int statusCode,IothubRemoveDeviceResponse* _Nullable removeDeviceResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubRemoveDeviceExecutor* excutor = [[IothubRemoveDeviceExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:removeDeviceRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubRemoveDeviceResponse* response = [[IothubRemoveDeviceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
importThingModel sync request
@param importThingModelRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `importThingModelResponse` the request response data model
*/
-(NSDictionary*) importThingModelSyncWithRequest:(IothubImportThingModelRequest*) importThingModelRequest
{
IothubImportThingModelExecutor* excutor = [[IothubImportThingModelExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:importThingModelRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubImportThingModelResponse* response = [[IothubImportThingModelResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"importThingModelResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)importThingModelAsyncWithRequest:(IothubImportThingModelRequest*) importThingModelRequest
                       completionHandler:(void(^)(int statusCode,IothubImportThingModelResponse* _Nullable importThingModelResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubImportThingModelExecutor* excutor = [[IothubImportThingModelExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:importThingModelRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubImportThingModelResponse* response = [[IothubImportThingModelResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
updateThingShadow sync request
@param updateThingShadowRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `updateThingShadowResponse` the request response data model
*/
-(NSDictionary*) updateThingShadowSyncWithRequest:(IothubUpdateThingShadowRequest*) updateThingShadowRequest
{
IothubUpdateThingShadowExecutor* excutor = [[IothubUpdateThingShadowExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:updateThingShadowRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubUpdateThingShadowResponse* response = [[IothubUpdateThingShadowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"updateThingShadowResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)updateThingShadowAsyncWithRequest:(IothubUpdateThingShadowRequest*) updateThingShadowRequest
                       completionHandler:(void(^)(int statusCode,IothubUpdateThingShadowResponse* _Nullable updateThingShadowResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubUpdateThingShadowExecutor* excutor = [[IothubUpdateThingShadowExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:updateThingShadowRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubUpdateThingShadowResponse* response = [[IothubUpdateThingShadowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeProduct sync request
@param describeProductRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeProductResponse` the request response data model
*/
-(NSDictionary*) describeProductSyncWithRequest:(IothubDescribeProductRequest*) describeProductRequest
{
IothubDescribeProductExecutor* excutor = [[IothubDescribeProductExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeProductRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubDescribeProductResponse* response = [[IothubDescribeProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeProductResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeProductAsyncWithRequest:(IothubDescribeProductRequest*) describeProductRequest
                       completionHandler:(void(^)(int statusCode,IothubDescribeProductResponse* _Nullable describeProductResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubDescribeProductExecutor* excutor = [[IothubDescribeProductExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeProductRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubDescribeProductResponse* response = [[IothubDescribeProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeThingShadow sync request
@param describeThingShadowRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeThingShadowResponse` the request response data model
*/
-(NSDictionary*) describeThingShadowSyncWithRequest:(IothubDescribeThingShadowRequest*) describeThingShadowRequest
{
IothubDescribeThingShadowExecutor* excutor = [[IothubDescribeThingShadowExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeThingShadowRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubDescribeThingShadowResponse* response = [[IothubDescribeThingShadowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeThingShadowResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeThingShadowAsyncWithRequest:(IothubDescribeThingShadowRequest*) describeThingShadowRequest
                       completionHandler:(void(^)(int statusCode,IothubDescribeThingShadowResponse* _Nullable describeThingShadowResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubDescribeThingShadowExecutor* excutor = [[IothubDescribeThingShadowExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeThingShadowRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubDescribeThingShadowResponse* response = [[IothubDescribeThingShadowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
addDevice sync request
@param addDeviceRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `addDeviceResponse` the request response data model
*/
-(NSDictionary*) addDeviceSyncWithRequest:(IothubAddDeviceRequest*) addDeviceRequest
{
IothubAddDeviceExecutor* excutor = [[IothubAddDeviceExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:addDeviceRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubAddDeviceResponse* response = [[IothubAddDeviceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"addDeviceResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)addDeviceAsyncWithRequest:(IothubAddDeviceRequest*) addDeviceRequest
                       completionHandler:(void(^)(int statusCode,IothubAddDeviceResponse* _Nullable addDeviceResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubAddDeviceExecutor* excutor = [[IothubAddDeviceExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:addDeviceRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubAddDeviceResponse* response = [[IothubAddDeviceResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
listProducts sync request
@param listProductsRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `listProductsResponse` the request response data model
*/
-(NSDictionary*) listProductsSyncWithRequest:(IothubListProductsRequest*) listProductsRequest
{
IothubListProductsExecutor* excutor = [[IothubListProductsExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:listProductsRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubListProductsResponse* response = [[IothubListProductsResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"listProductsResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)listProductsAsyncWithRequest:(IothubListProductsRequest*) listProductsRequest
                       completionHandler:(void(^)(int statusCode,IothubListProductsResponse* _Nullable listProductsResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubListProductsExecutor* excutor = [[IothubListProductsExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:listProductsRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubListProductsResponse* response = [[IothubListProductsResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
queryDeviceDetail sync request
@param queryDeviceDetailRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `queryDeviceDetailResponse` the request response data model
*/
-(NSDictionary*) queryDeviceDetailSyncWithRequest:(IothubQueryDeviceDetailRequest*) queryDeviceDetailRequest
{
IothubQueryDeviceDetailExecutor* excutor = [[IothubQueryDeviceDetailExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:queryDeviceDetailRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubQueryDeviceDetailResponse* response = [[IothubQueryDeviceDetailResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"queryDeviceDetailResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)queryDeviceDetailAsyncWithRequest:(IothubQueryDeviceDetailRequest*) queryDeviceDetailRequest
                       completionHandler:(void(^)(int statusCode,IothubQueryDeviceDetailResponse* _Nullable queryDeviceDetailResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubQueryDeviceDetailExecutor* excutor = [[IothubQueryDeviceDetailExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:queryDeviceDetailRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubQueryDeviceDetailResponse* response = [[IothubQueryDeviceDetailResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
queryDevicePage sync request
@param queryDevicePageRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `queryDevicePageResponse` the request response data model
*/
-(NSDictionary*) queryDevicePageSyncWithRequest:(IothubQueryDevicePageRequest*) queryDevicePageRequest
{
IothubQueryDevicePageExecutor* excutor = [[IothubQueryDevicePageExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:queryDevicePageRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubQueryDevicePageResponse* response = [[IothubQueryDevicePageResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"queryDevicePageResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)queryDevicePageAsyncWithRequest:(IothubQueryDevicePageRequest*) queryDevicePageRequest
                       completionHandler:(void(^)(int statusCode,IothubQueryDevicePageResponse* _Nullable queryDevicePageResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubQueryDevicePageExecutor* excutor = [[IothubQueryDevicePageExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:queryDevicePageRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubQueryDevicePageResponse* response = [[IothubQueryDevicePageResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
createProduct sync request
@param createProductRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `createProductResponse` the request response data model
*/
-(NSDictionary*) createProductSyncWithRequest:(IothubCreateProductRequest*) createProductRequest
{
IothubCreateProductExecutor* excutor = [[IothubCreateProductExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:createProductRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubCreateProductResponse* response = [[IothubCreateProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"createProductResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)createProductAsyncWithRequest:(IothubCreateProductRequest*) createProductRequest
                       completionHandler:(void(^)(int statusCode,IothubCreateProductResponse* _Nullable createProductResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubCreateProductExecutor* excutor = [[IothubCreateProductExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:createProductRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubCreateProductResponse* response = [[IothubCreateProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
updateProduct sync request
@param updateProductRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `updateProductResponse` the request response data model
*/
-(NSDictionary*) updateProductSyncWithRequest:(IothubUpdateProductRequest*) updateProductRequest
{
IothubUpdateProductExecutor* excutor = [[IothubUpdateProductExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:updateProductRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubUpdateProductResponse* response = [[IothubUpdateProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"updateProductResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)updateProductAsyncWithRequest:(IothubUpdateProductRequest*) updateProductRequest
                       completionHandler:(void(^)(int statusCode,IothubUpdateProductResponse* _Nullable updateProductResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IothubUpdateProductExecutor* excutor = [[IothubUpdateProductExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:updateProductRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IothubUpdateProductResponse* response = [[IothubUpdateProductResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}


 /**
 iothub common sync request
 @param  jdcloudDataRequest request param
 @return key `statusCode` http request status code type is int
             `dataResult` the http request response data  type is NSData
             `requestError` the request error type is NSError
 */
 -(NSDictionary*) iothubCommonSyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                                   url:(NSString*) url
                                                method:(NSString*) method{
    CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    NSDictionary* responseResult = [excutor executeDataSync:jdcloudDataRequest];
    return responseResult;
}

-(void)iothubCommonAsyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                         url:(NSString*) url
                                      method:(NSString*) method
                           completionHandler:(void(^)(int statusCode, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
     CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    
    [excutor executeDataAsync:jdcloudDataRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        completionHandler(statusCode,responseData,error);
    }];
} 

@end
